Number
class. Figure 2-1 shows the available
number classes. The "Numerics" chapter of the ScriptX
Components Guide provides additional information on the range
and precision of each of these classes.0.1234
rather than simply
.1234
. Floating-point numbers with no fractional
value must include a 0
after the decimal, that
is, 4.0
or 12345.0
, to differentiate
them from integers. For example, 4.0
is treated
as a floating point number, while 4
is treated as
an integer.Floating point numbers can also be represented using exponential notation.
6.023e23 -- Avogadro's number
Negative numbers are preceded by a minus sign.
-123.456
6.626e-27 -- Planck's constant
-0.99999999
Keep in mind that floating point values, unlike integers, are not stored with exact precision on computer systems.
4.2 -- it will be stored as an ImmediateFloat object
4.19999885559082
0x
notation. 0xFFF
0x04
When a hexadecimal number literal is evaluated, ScriptX
creates an instance of ImmediateInteger
or
LargeInteger
, just as it would for its decimal
equivalent. Only integer hexadecimal numbers are supported by
ScriptX.
This document is part of the ScriptX Language Guide, one of the volumes of the ScriptX Technical Reference Series. ScriptX is developed by the ScriptX Engineering Team at Apple Computer, successor to the Kaleida Engineering Team at Kaleida Labs, Inc.